# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2023-01-09
desc: 
sample: 
"""


class Person:


    def __init__(self,msg) -> None:
        super().__init__()

    def f1(self):
        print("我有一座金矿1")

    def f2(self):
        print("我有一座金矿2")

    def eat(self):
        print("喝粥")


class Student(Person):

    def f3(self):
        print("我有一座金矿3")

    # 多态（重写）
    def eat(self):
        print("吃饭")


class Student2:
    def f4(self):
        print("我有一座金矿4")

p=Person("test")
stu = Student("1212")
stu.eat()


# 多继承
class Student4(Student, Student2):

    # 对象创建时候自己调用
    def __init__(self, msg) -> None:
        self.msg = msg

    def eat(self):
        print("喝酒")

    # def eat(self):
    #     print(f"{self.msg}喝牛奶")


    def __str__(self) -> str:
       return f"---------{self.msg}"


stu4 = Student4("测试")
stu4.eat()
#打印的__str__ 地址
print(stu4)
stu4.addr1="北京"
stu4.addr2="上海"
#自动对象转行字典
print(stu4.__dict__)

print(stu4.addr2)


